package com.cci.kangdao.dao;

import com.cci.kangdao.dao.model.UserT;
import com.cci.kangdao.dao.model.UserTechnicians;
import com.cci.kangdao.message.UserInfo;
import com.cci.kangdao.model.ConductionInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mybatis.spring.annotation.MapperScan;

import java.util.List;
import java.util.Map;

/**
 * 用户表类dao
 *
 */
@MapperScan
public interface UserTDao {

	//根据工单id获取主技师姓名和手机号
	@Select("select top 1 b.ID,b.UserName,b.Contact,b.Phone from WorkOrderPrincipal_T a\n" +
			"inner join User_T b on a.UserId = b.ID\n" +
			"where a.OrderId = #{orderId} and a.IsPrincipal = 1 and a.OrderStatus in(7,8) and a.Flag = 0 and b.Flag = 0")
	Map<String,Object> getUserByOrderId(long orderId);

	//根据工单id获取副技师姓名和手机号
	@Select("select b.ID,b.UserName,b.Contact,b.Phone from WorkOrderPrincipal_T a\n" +
			"inner join User_T b on a.UserId = b.ID\n" +
			"where a.OrderId = #{orderId} and a.IsPrincipal = 0 and a.OrderStatus = 7 and a.Flag = 0 and b.Flag = 0")
	List<Map<String, Object>> getFuUserListByOrderId(long orderId);


	//根据服务站id获取服务站站长信息(可能多个)
	@Select("select  distinct d.* from Roles_T a " +
			"inner join UserGroupHasRole_T b on a.ID =b.RoleId " +
			"inner join UserHasRoles_T c on b.ID = c.RolesID " +
			"inner join User_T d on c.UserID = d.ID " +
			"where a.RolesNo='R0041' and a.Flag = 0 and b.Flag = 0 " +
			"and c.Flag = 0 and d.Flag = 0 and d.ServiceStationID = #{ServiceStationID}")
	public List<UserT> getUserTByServiceStationId(Map<String, Object> map);

	//根据二网服务站id获取所属服务站管理者（站长或信息员）信息
	@Select("select  distinct d.* from ServiceStation_T a "
			+ "inner join ServiceStationRelation_T b on a.ID = b.ChildID and a.Flag = 0 and b.Flag = 0 "
			+ "inner join ServiceStation_T c on c.id = b.ParentID and c.Flag = 0 "
			+ "inner join User_T d on d.ServiceStationID = b.ParentID and d.Flag = 0 "
			+ "inner join UserHasRoles_T e on d.ID = e.UserID and e.Flag = 0 "
			+ "inner join UserGroupHasRole_T f on e.RolesID = f.ID and f.Flag = 0 "
			+ "inner join Roles_T g on f.RoleId = g.ID and g.Flag = 0 and (g.RolesNo='R0041' or g.RolesNo='R0069') "
			+ "where a.ID = #{ServiceStationID}")
	public List<UserT> getStationMangerListByChildSSId(long ServiceStationID);

	@Select("select d.* from Roles_T a\n" +
			"  inner join UserGroupHasRole_T b on a.ID =b.RoleId\n" +
			"  inner join UserHasRoles_T c on b.ID = c.RolesID\n" +
			"  inner join User_T d on c.UserID = d.ID\n" +
			"  inner join WorkOrder_T workOrder on workOrder.ServiceStationId = d.ServiceStationID\n" +
			"  where a.RolesNo='R0041' and a.Flag = 0 and b.Flag = 0\n" +
			"  and c.Flag = 0 and d.Flag = 0 and workOrder.ID = #{orderId}")
	public List<UserT> getStationMasterByWorkOrderId(Long orderId);

	//根据服务站id获取服务站信息员信息(排除站长角色)
		@Select("select distinct d.* from Roles_T a " +
				"inner join UserGroupHasRole_T b on a.ID =b.RoleId " +
				"inner join UserHasRoles_T c on b.ID = c.RolesID " +
				"inner join User_T d on c.UserID = d.ID " +
				"where a.RolesNo='R0069' and a.Flag = 0 and b.Flag = 0 " +
				"and c.Flag = 0 and d.Flag = 0 and d.ServiceStationID = #{ServiceStationID} " +
				"and d.id not in ( "+
				"select  distinct d.id from Roles_T a " +
				"inner join UserGroupHasRole_T b on a.ID =b.RoleId " +
				"inner join UserHasRoles_T c on b.ID = c.RolesID " +
				"inner join User_T d on c.UserID = d.ID " +
				"where a.RolesNo='R0041' and a.Flag = 0 and b.Flag = 0 " +
				"and c.Flag = 0 and d.Flag = 0 and d.ServiceStationID = #{ServiceStationID}) ")
		public List<UserT> getMsgUserTByServiceStationId(Map<String, Object> map);

	//根据服务站id和工单id获取所有主副服务技师用户信息
	@Select("select distinct d.*,e.IsPrincipal from Roles_T a\r\n" +
			"inner join UserGroupHasRole_T b on a.ID =b.RoleId\r\n" +
			"inner join UserHasRoles_T c on b.ID = c.RolesID\r\n" +
			"inner join User_T d on c.UserID = d.ID\r\n" +
			"inner join WorkOrderPrincipal_T e on e.UserId = d.ID\r\n" +
			"where a.RolesNo='R0033' and a.Flag = 0 and b.Flag = 0\r\n" +
			"and c.Flag = 0 and d.Flag = 0 and e.Flag = 0 and d.ServiceStationID = #{serviceStationId} and e.OrderId=#{ID} and e.OrderStatus=7")
	public List<UserT> getUserTByServiceStationIdWorkOrderId(Map<String, Object> map);

	//通过服务站id获取这个服务站下所有的服务技师信息
	@Select("select a.* from User_T a\n" +
			"left join UserHasRoles_T b on a.ID=b.UserID\n" +
			"left join UserGroupHasRole_T c on c.ID = b.RolesID\n" +
			"left join Roles_T d on c.RoleId = d.ID\n" +
			"where d.RolesNo='R0033' and a.Flag = 0 and b.Flag = 0\n" +
			"and c.Flag = 0 and d.Flag = 0 and a.ServiceStationID = #{ServiceStationID}")
	public List<UserT> getServiceTechniciansListByServiceStationId(Map<String, Object> map);

	/**
	 * 技术支持的技师列表
	 * @param map
	 * @return
	 */
	public List<UserT> getGreatCraftsmanListByServiceStationId(Map<String, Object> map);

	@Select("select ut.* from User_T ut,WorkOrderPrincipal_T wop " +
			"where ut.Flag = 0 and wop.Flag = 0 and wop.UserId = ut.ID and wop.OrderId = #{orderId} and wop.IsPrincipal = 1 and wop.OrderStatus = #{orderStatus}")
	List<UserT> getTechnicianUserListByOrder(@Param("orderId") Long orderId,@Param("orderStatus") Integer orderStatus);

	@Select("select distinct a.* from User_T a\n" +
			"left join UserHasRoles_T b on a.ID=b.UserID\n" +
			"left join UserGroupHasRole_T c on c.ID = b.RolesID\n" +
			"left join Roles_T d on c.RoleId = d.ID\n" +
			"where a.Flag = 0 and b.Flag = 0 and c.Flag = 0 and d.Flag = 0\n" +
			"and (d.RolesNo='R0041' or d.RolesNo='R0069') and a.ServiceStationID = #{serviceStationId}")
	public List<UserT> getStationMasterListByServiceStationId(Long serviceStationId);

	@Select("select * from User_T where Flag = 0 and ID = #{id}")
	UserT selectById(Long id);

	int updateByPrimaryKeySelective(UserT userT);

	int updateCityAndproviceSelective(UserT userT);

	//根据用户id获取当前用户用户组类型信息
	@Select("select a.* from Usergroup_T a \n" +
			"left join User_T b on a.ID = b.UsergroupID\n" +
			"where a.Flag =0 and b.Flag = 0 and b.ID=#{userId}")
	Map<String, Object> getUsergroupbyUserId(Long userId);

	@Select("select * from User_T where Flag = 0 and PromotionId = #{PromotionId}")
	UserT getUserByPromotionId(String promotionId);

	@Select("select * from User_T where Flag = 0")
	List<UserT> getEffectiveUserList();

	//获取意见反馈表处理中工单的处理人信息
	@Select("select b.Email,a.BillNo,a.Content from FeedBack_T a\n" +
			"inner join User_T b on a.DealerId = b.ID \n" +
			"where a.Flag = 0 and a.BillStatus = 1 and b.Flag = 0")
	List<Map<String,Object>> getNotDealFeedBackUserList();

	@Select("select a.*,b.IsType,b.GroupName as usergroupName,c.GroupName as usergroupSubName, ct.CompanyName as companyName, ss.StationName as stationName\n" +
			" from User_T a left join Usergroup_T b on a.UsergroupID=b.ID left join UsergroupSub_T c on a.UsergroupSubID=c.ID\n" +
			" left join Company_T ct on a.CompanyID = ct.ID left join ServiceStation_T ss on a.ServiceStationID = ss.ID\n" +
			" where a.Flag=0 and lower(a.EmployeeNum)=lower(#{employeeNum})")
	UserT getUserByEmployeeNum(String employeeNum);

	@Select("select top 1 * from User_T where Flag = 0 and (UserName = #{phone} or Phone = #{phone})")
	UserT getUserByPhone(String phone);

	@Select("select top 1 * from User_T where Flag = 0 and Type = 2 and UserName = #{wwid}")
	UserT getUserByWWid(String wwid);

	@Select(" <script> select  * from User_T where Flag = 0 and <foreach collection='phoneList' item='item' open='(' separator='or' close=')'>    UserName = #{item} or Phone = #{item}  </foreach>  </script>")
	List<UserT> getUserByPhoneList(@Param("phoneList")List<String> phoneList);

	@Select("select b.*,a.CompanyID,a.ServiceStationID from User_T a\n" +
			"inner join Usergroup_T b on a.UsergroupID = b.ID\n" +
			"where a.Flag = 0 and b.Flag = 0 and a.ID = #{userId}")
	Map<String,Object> getUserOrganizationType(long userId);

	//根据用户id判断是否为审批人
	@Select("select ID from GMAuthUser_T where handlerId = #{userId} and Flag = 0")
	Long checkApproverStatusById(long userId);

	//根据用户id判断是否为站长
	@Select("select u.ID from User_T u\n" +
			"left join UserHasRoles_T uhr on u.ID = uhr.UserID\n" +
			"left join UserGroupHasRole_T ughr on uhr.RolesID = ughr.ID\n" +
			"left join Roles_T r on ughr.RoleId = r.ID\n" +
            "where u.Flag = 0 and r.Flag = 0 and uhr.Flag = 0 and ughr.Flag = 0 and r.RolesNo = 'R0041' and u.ID = #{userId}")
	Long checkHeaderStatusById(long userId);

	//根据工单id和是否主技师获取对应的技师用户列表
    @Select("select distinct c.* from WorkOrder_T a\n" +
			"inner join WorkOrderPrincipal_T b on a.ID = b.OrderId\n" +
			"inner join User_T c on b.UserId = c.ID\n" +
			"where b.OrderStatus = 7 and a.ID = #{orderId} and b.Flag = 0 and c.Flag = 0 and b.IsPrincipal = #{isPrincipal}")
	List<UserT> getJSUserListByOrderStatus(@Param("orderId") Long orderId,@Param("isPrincipal") int IsPrincipal);

	//移动技师获取用户相关sql
	//获取站长信息员信息
	@Select("select a.ID as userId,a.UserName as userName,a.phone,a.email,a.contact,e.clientId,d.RolesNo as roleNo from User_T a\n" +
			"left join UserHasRoles_T b on a.ID=b.UserID\n" +
			"left join UserGroupHasRole_T c on c.ID = b.RolesID\n" +
			"left join Roles_T d on c.RoleId = d.ID\n" +
			"left join RelationShip_T e on a.UserName = e.UserName\n" +
			"where a.Flag = 0 and b.Flag = 0 and c.Flag = 0 and d.Flag = 0\n" +
			"and (d.RolesNo='R0041' or d.RolesNo='R0069') and a.ServiceStationID = #{servicestationid}")
	List<Map<String,Object>> getStationMangerListFromMTServiceStationID(@Param("servicestationid")long servicestationid);

	//移动技师获取用户相关sql
    //根据用户id获取用户信息
    @Select("<script>select a.ID as userId,a.UserName as userName,a.phone,a.email,a.contact,b.clientId from User_T a\n" +
            "left join RelationShip_T b on a.UserName = b.UserName\n" +
            "where a.ID in  <foreach collection='userIds' item='item' open='(' separator=',' close=')'>       #{item}  </foreach> and a.Flag = 0 </script>")
    List<Map<String, Object>> getUsersInfoListFromMTUserId(@Param("userIds") List<String> userIds);


    //移动技师获取用户相关sql
    //根据角色编号获取用户信息
    @Select("<script> select a.ID as userId,a.UserName as userName,a.phone,a.email,a.contact,e.clientId,d.RolesNo as roleNo from User_T a\n" +
            "left join UserHasRoles_T b on a.ID=b.UserID\n" +
            "left join UserGroupHasRole_T c on c.ID = b.RolesID\n" +
            "left join Roles_T d on c.RoleId = d.ID\n" +
            "left join RelationShip_T e on a.UserName = e.UserName\n" +
            "where a.Flag = 0 and b.Flag = 0 and c.Flag = 0 and d.Flag = 0\n" +
            "and d.RolesNo in <foreach collection='roleNos' item='item' open='(' separator=',' close=')'>#{item} </foreach> </script>")
    List<Map<String, Object>> getRoleNosUsersInfoListFromMTUserId(@Param("roleNos") List<String> roleNos);


	//根据用户手机号判断用户是否存在
    @Select("select count(*) from User_T where Flag = 0 and Phone = #{phone}")
	int checkUserByPhone(@Param("phone")String phone);


    //移动技师相关sql
    List<Map<String, Object>> getUserInfoListByIds(List<Long> userIds);



    List<UserInfo> getUserPushInfoByUserId(@Param("list") List<Long> userIds);

	/**
	 *  根据三兄弟传过来的手机查询用户表中是否存在相关的数据
	 * @param phone
	 * @return
	 */
    @Select("select top 1 * from User_T  where (UserName = #{phone} or Phone =#{phone}) and flag = 0")
	UserT checkUserByNameOrPhone(@Param("phone") String phone);

	/**
	 *  根据邀请码查询用户表中是否存在相关的数据
	 * @param inviteCode
	 * @return
	 */
	@Select("select top 1 * from User_T  where inviteCode = #{inviteCode} and flag = 0")
	UserT getUserByInviteCode(@Param("inviteCode") String inviteCode);

    /**
     * 查询当前的id用户是否包含指定的角色
     * @return
     */
    @Select("select " +
    		"	count(a.id) " +
    		"from User_T a " +
    		"	join UserHasRoles_T b on a.ID = b.UserID and a.Flag = 0 and b.Flag = 0 " +
    		"	join UserGroupHasRole_T c on c.ID = b.RolesID and c.Flag = 0 " +
    		"	join Roles_T d on c.RoleId = d.ID and d.Flag = 0 " +
    		"where  " +
    		"	a.id = #{userId} and d.RolesNo = #{roleNo}")
    int isContainsRoleNo(@Param("userId")Long userId, @Param("roleNo")String roleNo);


	/**
	 * 查询当前的id用户是否包含指定的角色
	 * @return
	 */
	@Select("select " +
			"	count(a.id) " +
			"from User_T a " +
			"	join UserHasRoles_T b on a.ID = b.UserID and a.Flag = 0 and b.Flag = 0 " +
			"	join UserGroupHasRole_T c on c.ID = b.RolesID and c.Flag = 0 " +
			"	join Roles_T d on c.RoleId = d.ID and d.Flag = 0 " +
			"where  " +
			"	a.id = #{userId} and d.RolesNo !=#{roleNo} ")
	int isContainsNotRoleNo(@Param("userId")Long userId, @Param("roleNo") String roleNo);


    @Select("select top 2 * from User_T  where (UserName = #{phone} or Phone =#{phone}) and flag = 0")
	List<UserT> getUserByNameOrPhone(@Param("phone") String phone);

    @Update("update User_T set UserCompanyName = #{companyName} where ID = #{userId}")
    int updateCompanyNameByID(@Param("userId") Long userId, @Param("companyName") String companyName);

    @Select("select count(1) from User_T where flag = 0 and email = #{email} and id != #{userId}")
    int countByEmail(@Param("email") String email, @Param("userId") Long userId);

    @Update("Update User_T set email = #{email} where id = #{userId}")
    int updateEmailByUserId(@Param("email") String email, @Param("userId") Long userId);


    @Select("select " +
    		"	d.RolesNo " +
    		" from " +
    		" User_T a " +
    		" Left Join UserHasRoles_T b ON a.ID = b.UserID " +
    		" Left Join UserGroupHasRole_T c ON c.ID = b.RolesID " +
    		" Left Join Roles_T d ON d.ID = c.RoleId " +
    		" where b.Flag = 0 and c.Flag = 0 and d.Flag = 0 " +
    		" and a.ID = #{userId} ")
    List<String> getUserHasRolesByUserID(@Param("userId") Long userId);




	// 获取某个渠道的渠道管理员
	@Select("select d.id userId, d.phone, d.email, e.clientId from Roles_T a " +
			"		inner join UserGroupHasRole_T b on a.ID =b.RoleId " +
			"		inner join UserHasRoles_T c on b.ID = c.RolesID " +
			"		inner join User_T d on c.UserID = d.ID " +
			"		left join RelationShip_T e on e.UserName = d.UserName " +
			"		where a.RolesNo='R0102' and a.Flag = 0 and b.Flag = 0  " +
			"		and c.Flag = 0 and d.Flag = 0 and d.CompanyID = #{companyId}")
	public List<UserInfo> getChannelAdministrator(@Param("companyId") Long companyId);


	// 获取分公司管理员
	public List<UserInfo> subStationAdministrator(@Param("serviceStationId") Long serviceStationId);


	@Select("select d.id userId, d.phone, d.email, e.clientId from Roles_T a " +
			"		inner join UserGroupHasRole_T b on a.ID =b.RoleId " +
			"		inner join UserHasRoles_T c on b.ID = c.RolesID " +
			"		inner join User_T d on c.UserID = d.ID " +
			"		left join RelationShip_T e on e.UserName = d.UserName " +
			"		where a.RolesNo='R0041' and a.Flag = 0 and b.Flag = 0  " +
			"		and c.Flag = 0 and d.Flag = 0 and d.ServiceStationID = #{serviceStationId}")
	public List<UserInfo> getStationMasterByServiceStationId(@Param("serviceStationId") Long serviceStationId);


	@Select(" select top 1 a.id userId, a.phone, a.email, c.clientId " +
			" from User_T a " +
			" join GMApplyRecord_T b on a.id = b.UserId " +
			" left join RelationShip_T c on c.UserName = a.UserName " +
			"  where b.id = #{recordId}")
	UserInfo getUserInfoByRecordId(@Param("recordId") Long recordId);

    List<Map<String, Object>> getPhoneAndClientIdByUserIds(@Param("list") List<Long> userIds);


    //修改用户表用户组和服务站id字段   置为终端用户
    @Update("update User_T set ServiceStationID = 0,UsergroupID = 1,UsergroupSubID = 0 where Flag = 0 and ServiceStationID = #{serviceStationID}")
    int updateEndUserByUserId(@Param("serviceStationID") long serviceStationID);

    List<Map<String, Object>> getAuthCompanyByStationId(@Param("serviceStationID")Long serviceStationID);

    Map<String, Object> getCompanyById(@Param("companyId") Long companyId);

    Map<String, Object> getServiceStationById(@Param("serviceStationId") Long serviceStationId);


	/**
	 * 根据订单id获取主副技师
	 * @param orderId
	 * @return
	 */
	@Select("select b.ID,b.UserName,b.Contact,b.Phone,a.IsPrincipal from WorkOrderPrincipal_T a  inner join User_T b on a.UserId = b.ID where a.OrderId =  #{orderId} and a.IsPrincipal in (0,1) and a.OrderStatus = 7 and a.Flag = 0 and b.Flag = 0")
	List<UserTechnicians> getMainAndAuxiByOrderId(long orderId);


    /**
     * 查询出DCEC渠道下某个服务站的商务处主任
     */
    List<Map<String, Object>> getBusinessDirectorDcecByServiceStationId(@Param("serviceStationId")Long serviceStationId);

	int updateUserMsgById(UserT userT);

	public List<UserT> getUsersByIds(List<Long> ids);

    List<String> getPhoneByPhoneList(List<String> list);

	public boolean deleteDate(List<Long> ids);

    /**
     * 查询用户是否有该角色
     *
     * @param rolesNo
     * @param userId
     * @return
     */
    @Select("select  COUNT(*) from\n" +
            "User_T ut left join UserHasRoles_T uhr on ut.ID= uhr.UserID and ut.Flag=0 and uhr.Flag=0\n" +
            "left join UserGroupHasRole_T ughr on uhr.RolesID = ughr.ID and uhr.Flag=0 and uhr.Flag=0\n" +
            "left join Roles_T rt on rt.ID = ughr.RoleId and rt.Flag=0 and ughr.Flag=0\n" +
            "where  rt.RolesNo =#{rolesNo}  and ut.Flag=0 and uhr.Flag=0 and ughr.Flag=0 and rt.Flag=0 and ut.ID=#{userId}")
    Integer getUserCountByRoleAndUserId(@Param("rolesNo") String rolesNo, @Param("userId") Long userId);


	//根据服务站编号，esn通过芯管家表查询出用户信息
	@Select("select distinct b.Contact as customerName,b.Phone as customerPhone,'' as customerCompanyName,\n" +
			"'' as location,'' as locLat,'' as locLon from FleetAndEsnRelation_T a\n" +
			"inner join User_T b on a.UserId = b.ID\n" +
			"where a.Flag = 0 and a.Esn = #{esn} and a.SSNo = #{ssno}")
	List<Map<String, Object>> getUserByEsnSSno(@Param("esn") String esn, @Param("ssno") String ssno);

	int getXgjRoleList(Long userId);


	//根据服务站id和工单id获取所有主副服务技师用户信息
	@Select("select distinct d.*,e.IsPrincipal from Roles_T a\r\n" +
			"inner join UserGroupHasRole_T b on a.ID =b.RoleId\r\n" +
			"inner join UserHasRoles_T c on b.ID = c.RolesID\r\n" +
			"inner join User_T d on c.UserID = d.ID\r\n" +
			"inner join WorkOrderPrincipal_T e on e.UserId = d.ID and e.IsPrincipal=1\r\n" +
			"where a.RolesNo='R0033' and a.Flag = 0 and b.Flag = 0\r\n" +
			"and c.Flag = 0 and d.Flag = 0 and e.Flag = 0 and d.ServiceStationID = #{serviceStationId} " +
			"and  e.OrderId=#{orderId} and e.OrderStatus=7")
	public List<UserT> getUserTStationIdAndOrderId(@Param("serviceStationId") Long serviceStationId,
												   @Param("orderId") Long orderId);


	//是否为终端用户
	int isEndUser(@Param("userId") Long userId);

	//服务站编码
	String getBusinessByUserId(@Param("userId") Long userId);

	//是否为wwid用户
	int isWWIDUser(@Param("userName") String userName);

	//修改指引类型
	@Update("update User_T set GuideType = 0 where ID = #{id}")
	int updateGuideTypeByUserId(@Param("id") Long id);


	//修改指引类型
	@Update("update User_T set GuideFunType = 0 where ID = #{id}")
	int updateGuideFunTypeByUserId(@Param("id") Long id);

	//修改vip
	@Update("update VIP_VehicleUser_T set UserId = #{userId} where Flag = 0 and UserId = #{oldUserId}")
	int updateVehicleByUserId(@Param("oldUserId") Long oldUserId,@Param("userId") Long userId);

	//修改vip
	@Update("update VIP_ToSharedUser_T set ToSharerUserId = #{userId},UserName = #{userName},Phone = #{phone} where Flag = 0 and ToSharerUserId = #{oldUserId}")
	int updateToSharedByUserId(@Param("oldUserId") Long oldUserId,@Param("userId") Long userId,@Param("userName") String userName,@Param("phone") String phone);

	//修改vip
	@Update("update VIP_ToSharedUser_T set UserId = #{userId} where Flag = 0 and UserId = #{oldUserId}")
	int updateSharedByUserId(@Param("oldUserId") Long oldUserId,@Param("userId") Long userId);

	@Select("select top 1 InvitationCode as invitationCode,Channel as channel from ConductionRelation_T where Flag = 0 and UserId = #{userId} order by CreateTime desc")
	ConductionInfo getConductionByUserId(@Param("userId")Long userId);

    List<String> getTechnicianCompaynNo(long userId);
    List<String> getEngineerCompaynNo(long userId);
	@Select("<script> select * from user_t where flag=0 and id in <foreach collection='list' item='item' open='(' separator=',' close=')'>       #{item}  </foreach> </script>")
	List<UserT> getListByIdList(@Param("list")List<Long> list);

}
